# Contributor: j.r <j.r@jugendhacker.de>
# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Maria Lisina <sekoohaka.sarisan@gmail.com>
pkgname=telegram-tdlib
pkgver=1.8.39
pkgrel=0
# they don't tag releases
_gitrev=056963e48fa8d3f89556239c22d6ac843d3c8a5b
pkgdesc="Cross-platform library for building Telegram clients"
url="https://core.telegram.org/tdlib"
arch="all !s390x" # fails to build on big-endian
license="BSL-1.0"
makedepends="cmake gperf linux-headers openssl-dev samurai zlib-dev"
subpackages="$pkgname-static $pkgname-dev"
source="td-$_gitrev.tar.gz::https://github.com/tdlib/td/archive/$_gitrev.tar.gz"

builddir="$srcdir/td-$_gitrev"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr

	cmake --build build
}

check() {
	ctest --output-on-failure --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
9392e6267a82142e4c53aa8ef140bbd88d60562f52ffbfcd6c4657248267a9be20b0cc53310cbc54d4918cca1d66c27906a447f3df49fc9b1e4e75f731008c93  td-056963e48fa8d3f89556239c22d6ac843d3c8a5b.tar.gz
"
